const path = require('path');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');

module.exports = merge(common, {
  mode: 'development',
  devtool: 'inline-source-map',
  // 用来开启一个Web服务
  devServer: {
    contentBase: path.resolve(__dirname, "dist"),
    compress: true, // 一切服务都启用gzip 压缩
    port: 9000,
    host: '10.33.178.212',
    hot: true, // 启用 webpack 的模块热替换特性,模块修改不刷新页面
    // inline: false,
    // 在浏览器全屏页面上显示错误，默认是false
    overlay: {
      warnings: true,
      errors: true
    },
    // progress: true, // 将运行进度输出到控制台
    // open: true, // 打开浏览器页面
    historyApiFallback: { // mode:'history';路由history模式下的配置
      rewrites: [{
        from: /.*/,
        to: path.resolve('/', 'index.html')
      }]
    }
  },
  // "server": "webpack-dev-server --mode development",
});